package com.yidu.ladder.transfer.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.yidu.ladder.transfer.domain.CloseWrapsVo;
import com.yidu.ladder.transfer.service.CloseWrapService;
/**
 * 合包控制器
 * @author bamboo
 *
 */
@Controller
@RequestMapping("/transfer/closeWraps")
public class CloseWrapController {
	@Autowired
	private CloseWrapService closeWrapService;
	
	
	public CloseWrapService getCloseWrapService() {
		return closeWrapService;
	}

	public void setCloseWrapService(CloseWrapService closeWrapService) {
		this.closeWrapService = closeWrapService;
	}
	
	@RequestMapping(value="closeWraps",method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> findAll(CloseWrapsVo closeWrapsVo){
		Map<String, Object> map = closeWrapService.selectAll(closeWrapsVo);
		return map;
	}
	
	
	
	@ResponseBody
    @RequestMapping(value="/ajaxUpload",method={RequestMethod.GET,RequestMethod.POST})
    public Map<String, String> ajaxUploadExcel(@RequestParam("file")MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {
    //    System.out.println("进来了");
        Map<String, String> map = new HashMap<>();
        closeWrapService.ajaxUploadExcel(file, request, response);
        map.put("msg", "ok");
        return map;
    }
}
